import headss from '../../components/header/index.vue'
import Vue from 'vue'
import { Lazyload, Swipe, SwipeItem,Rate } from 'vant'
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
import loading from '../../components/loading/index.vue'
import BScroll from '@better-scroll/core'
Vue.use(Lazyload)
export default {
  name:'jiyang',
  data:function(){
    return {
      value: 3,
      swiperOption: {
        direction: 'vertical',
        slidesPerView: 'auto',
        freeMode: true,
        scrollbar: {
          el: '.swiper-scrollbar'
        },
        mousewheel: true,
        on: {
          touchEnd: function(swiper,event){
            //你的事件
            console.log('我到底了')
          },
        },
      },
      loopData0: [
        {
          lanhuimage0:
            'https://lanhu.oss-cn-beijing.aliyuncs.com/ps9qmkgcnc6heyczc9yr4agddy1stp86mfc4d1e1009-0118-4960-b148-6ebc499ba556',
          lanhutext0: '犬细小',
        },
        {
          lanhuimage0:
            'https://lanhu.oss-cn-beijing.aliyuncs.com/pshfho2shqdm9iktmzons8dpz77bievu2ehc5ed92a0-edcb-4d5a-bbba-f3154ec7cced',
          lanhutext0: '猫传腹',
        },
        {
          lanhuimage0:
            'https://lanhu.oss-cn-beijing.aliyuncs.com/psy6xk0dvsqno8v0z7gek84eh9t8v3fq35pea9be13f-2221-4286-a64a-b5d6b0b47f1b',
          lanhutext0: '莱姆症',
        },
        {
          lanhuimage0:
            'https://lanhu.oss-cn-beijing.aliyuncs.com/psq0ol2vmqcabz6gyks8jh1osf7djz2t4bmb9bf3394-9bdd-4a0a-a40c-9565ccdd88d8',
          lanhutext0: '关节脱位',
        },
        {
          lanhuimage0:
            'https://lanhu.oss-cn-beijing.aliyuncs.com/psxqn4gpinse1jo38xu6ud2hnm20fyjgkte94cd3ff-d511-4ed8-980f-5010ee0cad45',
          lanhutext0: '角膜溃疡',
        },
      ],
      images: [
        'https://lanhu.oss-cn-beijing.aliyuncs.com/ps73t56bwzogd05q5ywrd9q96y8fhmn5icydf767a32-b2a5-43e9-98c4-385b7bc8e5e2',
        'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704932698007257.png',
        'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704932698007257.png',
        'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704932698007257.png'
      ],	
      list:[{
        image:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704915125197715.png',
        name:"淘气联盟宠物店",
        id:1,
        dress:'丰台长丰园和顺家园底商B23-89',
        juli:'3.55km'
      },{
        image:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704926753712403.png',
        name:"喵喵幼稚园",
        dress:'丰台长丰园和顺家园底商B23-89',
        juli:'3.55km',
        id:2
      },{
        image:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704928180408293.png',
        name:"淘气联盟宠物店",
        dress:'丰台长丰园和顺家园底商B23-89',
        juli:'3.55km',
        id:3
      },{
        image:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704929417822702.png',
        name:"淘气联盟宠物店",
        dress:'丰台长丰园和顺家园底商B23-89',
        juli:'3.55km',
        id:4
      },{
        image:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704929417822702.png',
        name:"淘气联盟宠物店",
        dress:'丰台长丰园和顺家园底商B23-89',
        juli:'3.55km',
        id:5
      },{
        image:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704929417822702.png',
        name:"淘气联盟宠物店",
        dress:'丰台长丰园和顺家园底商B23-89',
        juli:'3.55km',
        id:6
      },{
        image:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406704929417822702.png',
        name:"淘气联盟宠物店",
        dress:'丰台长丰园和顺家园底商B23-89',
        juli:'3.55km',
        id:7
      }],
      loading: true,
      scroll:0,
    }
  },
  components: {
    [Swipe.name]: Swipe,
    [SwipeItem.name]: SwipeItem,
    [Rate.name]: Rate,
    headss,
    Swiper,
    SwiperSlide,
    loading
  },
  mounted() {
    setTimeout(() => {
      this.loading = false
      this.init()
    }, 1000);
  },
  beforeDestroy() {
    this.bs.destroy()
  },
  activated(){
    if(this.bs){
      this.bs.refresh()
      this.bs.scrollTo(0,this.scroll, 0)
    }
  },
  deactivated(){
    this.scroll = this.bs.y
    console.log('我离开了')
  },
  methods: {
    init() {  
      this.bs = new BScroll(this.$refs.scroll, {
        probeType: 1,
        click: true
      })
      this.bs.on('scrollStart', () => {
        console.log('scrollStart-')
      })
      this.bs.on('scroll', ({ y }) => {
        console.log('scrolling-')
      })
      this.bs.on('scrollEnd', (pos) => {
        console.log(pos)
      })  
    },
    clickHandler (item) {
      window.alert(item)
    },
    goto(){
      this.$router.go(-1)
    },
    go(){
      this.$router.push({
        name:'consult'
      })
    },
    gos(){
      this.$router.push({
        name:'DiseaseDetails'
      })
    },
    gotso(){
      this.$router.push({
        name:'HospitalDetails'
      })
    }
  }
}
